#ifndef PASSWORDHELPER_H
#define PASSWORDHELPER_H

#include <QString>
#include <botan/botan.h>

class PasswordHelper
{
public:
    PasswordHelper(QString salt = "");
    ~PasswordHelper();

    /*
     * Returns the current salt that needs to be saved.
     */
    QString salt();

    /*
     * Decrypts a strings
     */
    bool decrypt(QString &in, QString *out);

    /*
     * Encrypts a string.
     */
    bool encrypt(QString &in, QString *out);

private:
    /*
     * Initializes the crypto keys.
     */
    void init(QString salt = "", QString passphrase = "");

    Botan::LibraryInitializer mInit;
    bool mInitialized;
    QString mSalt;      // the current salt
    std::string mKey;   // the key

};

#endif // PASSWORDHELPER_H
